package cn.ctvonline.android.kaopu.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;

import cn.ctvonline.android.kaopu.R;
import cn.ctvonline.android.kaopu.base.BaseAppCompatActivity;
import cn.ctvonline.android.kaopu.fragment.ImageShowActivityFragment;

public class ImageShowActivity extends BaseAppCompatActivity {
    ImageShowActivityFragment imageShowFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(TAG, "this is ImageShowActivity onCreate method");
        setContentView(R.layout.activity_image_show);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        findViews();
        imageShowFragment = (ImageShowActivityFragment) getSupportFragmentManager().findFragmentById(R.id.content_image_show_fragment);
        Intent intent = getIntent();
        onNewIntent(intent);
    }

    private void findViews() {

    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        if (intent != null && intent.hasExtra("imageUri")) {
            String imageUri = intent.getStringExtra("imageUri");
            imageShowFragment.setImagePath(imageUri);
            imageShowFragment.reloadImage();
        }
    }

    @Override
    protected String generatePageName() {
        return "pageName ImageShowActivity";
    }
}
